import './index.scss';
import React from 'react';

function Modal(props) {
  //子组件CheckModal/EditModal传递过来的填充插槽位置：
  //外界决定显示modal组件 isShowModal
  //外界传入标题名称 modalTitle
  //外界插入的内容 children
  const { isShowModal,modalTitle,children } = props;

  return (
    //在JSX内容里插入children元素标签内容
    <>
      {
        isShowModal
        ?
        (
            <div className='modal'>
              <div className="inner">
                <div className="m-header">
                  { modalTitle }
                </div>
                <div className="content-wrapper">
                  { children }
                </div>
              </div>
          </div>
        )
        :
        ''
      }
    </>
  );
}

export default Modal;